package jse;

/**
 * @desc   重写toString 方法
 * @author kanggw
 * @datetime 2016年4月5日,下午9:01:16
 */
public class Test20160105RewriteToString {

	//成员变量
	private String name;
	private Integer age;
	private double weight;
	
	//构造方法
	public Test20160105RewriteToString() {
		 
	}
	
	public Test20160105RewriteToString(String name,int age,double weight) {
		 
		this.name = name;
		this.age = age;
		this.weight = weight;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}
	
	@Override
	public String toString() {
		
		StringBuilder sb = new StringBuilder();
		sb.append("名称"+name+"\n");
		sb.append("年龄"+age+"\n");
		sb.append("体重"+weight+"\n");
		
		return sb.toString(); 
	}
}
